const defaultState = {
    list: ['task1', 'task2']
};

const reducer = (state = defaultState, action) => {
    switch (action.type) {
    case 'LOAD_DATA':
        return state;
    case 'PUT_DATA':
        return {
            list: [
                ...state.list,
                action.task
            ]
        };
    case 'REMOVE_DATA':
        // console.log(state.list, action.task);
        return {
            list: [...state.list].filter((i, idx) => idx !== action.task)
        };
    default:
        return state;
    }
};

export default reducer;
